package com.hnkywl.sts.entity.organ.search;

import com.hnkywl.sts.util.QuerySearcher;
import org.apache.commons.lang3.StringUtils;

/**
 * Created with IntelliJ IDEA.
 * User: 朱强
 * Date: 13-4-12
 * Time: 下午3:33
 * To change this template use File | Settings | File Templates.
 */
public class QueryLj extends QuerySearcher {
    private String jyjg;

    private String lx;

    private String sxy;

    private String sfkjxy;

    private String qy;

    private String jybm;

    public String getQy() {
        return qy;
    }

    public void setQy(String qy) {
        this.qy = qy;
    }

    public String getJyjg() {
        return jyjg;
    }

    public void setJyjg(String jyjg) {
        this.jyjg = jyjg;
    }

    public String getLx() {
        return lx;
    }

    public void setLx(String lx) {
        this.lx = lx;
    }


    public String getSxy() {
        return sxy;
    }

    public void setSxy(String sxy) {
        this.sxy = sxy;
    }

    public String getSfkjxy() {
        return sfkjxy;
    }

    public void setSfkjxy(String sfkjxy) {
        this.sfkjxy = sfkjxy;
    }

    public String getJybm() {
        return jybm;
    }

    public void setJybm(String jybm) {
        this.jybm = jybm;
    }

    public String getQyHql() {
        return StringUtils.isEmpty(getQy()) ? "" : "(sy.id = " + getQy() + " or xy.id =" + getQy() + " )";
    }

    public String getJyjgHql() {
        return StringUtils.isEmpty(getJyjg()) ? "" : "lj.jyjg.id = " + getJyjg();
    }

    public String getJyjgSql() {
        return StringUtils.isEmpty(getJyjg()) ? "" : "jyjg_id = " + getJyjg();
    }

    public String getLxHql() {
        return StringUtils.isEmpty(getLx()) ? "" : "lj.lx in (" + getLx() + ")";
    }

    public String getLxSql() {
        return StringUtils.isEmpty(getLx()) ? "" : "lx in (" + getLx() + ")";
    }

    public String getSfkjxyHql() {
        return StringUtils.isEmpty(getSfkjxy()) ? "" : "lj.sfkjxy = " + getSfkjxy();
    }

    public String getSfkjxySql() {
        return StringUtils.isEmpty(getSfkjxy()) ? "" : "sfkjxy = " + getSfkjxy();
    }

    public String getJybmHql() {
        return StringUtils.isEmpty(getJybm()) ? "" : " ( lj.createDepartment.id = " + getJybm() + " or bm.sfjyzz = false ) ";
    }

    public String getHql() {
        return joinSearcher(getJyjgHql(), getLxHql(), getSfkjxyHql(),getQyHql());
    }

    public String getSql() {
        return joinSearcher(getJyjgSql(), getLxSql(), getSfkjxySql());
    }
}
